﻿using System;
using System.Collections.Generic;

namespace Redis
{
    public interface ICacheService
    {
        /// <summary>
        /// Check the key is exist in cache.
        /// </summary>
        /// <param name="key">Name of the key.</param>
        bool Contains(string key);

        /// <summary>
        /// Add an object to the cache with a key name.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        void Add(string key, object value);

        /// <summary>
        /// Add an item to the cache with an expire datetime.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="expireDate">The expire date.</param>
        void Add(string key, object value, DateTime expireDate);

        /// <summary>
        /// Add an item to the cache with an expire hours.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="expireHours">The expires in hours.</param>
        void Add(string key, object value, int expireHours);

        /// <summary>
        /// Add an item to the cache with an expire hours.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="expireHours">The expires in hours.</param>
        int Increment(string key, int defaultValue, int delta, int expireHours);

        /// <summary>
        /// Add an item to the cache with an expire hours.
        /// </summary>
        /// <param name="key">The key.</param>
        /// <param name="value">The value.</param>
        /// <param name="expireHours">The expires in hours.</param>
        ulong Increment(string key, ulong defaultValue, ulong delta, int expireHours);

        /// <summary>
        /// Get an Item from the cache.
        /// </summary>
        /// <param name="key">Name of the key.</param>
        /// <returns></returns>
        object Get(string key);

        /// <summary>
        /// Get an Item from the cache.
        /// </summary>
        /// <param name="key">Name of the key.</param>
        /// <returns>Object by inputed type</returns>
        T Get<T>(string key);

        /// <summary>
        /// Remove an item from the cache.
        /// </summary>
        /// <param name="key">The key.</param>
        void Remove(string key);

        /// <summary>
        /// Clear all cache.
        /// </summary>
        void FlushAll();

        /// <summary>
        /// Delete a list of keys
        /// </summary>
        /// <param name="lkey"></param>
        void MultilDelete(List<string> lkey);

        #region More common function in EnyimMemcache

        /// <summary>
        /// Get many items from cache.
        /// </summary>
        /// <param name="keys">A list of key</param>
        /// <returns>Dictionary of key and value pair</returns>
        IDictionary<string, object> Get(IEnumerable<string> keys);

        /// <summary>
        /// Get many items from cache.
        /// </summary>
        /// <param name="keys">A list of key</param>
        /// <returns>Dictionary of key and value pair</returns>
        IDictionary<string, T> Get<T>(IEnumerable<string> keys);

        #endregion
    }
}
